package com.qf.application.context;

import com.qf.application.entity.LoginUser;
import com.qf.application.entity.UserToken;

// 用ThreadLocal来管理用户登录信息
public class UserContextHolder {

    private static ThreadLocal<LoginUser> threadLocal = new ThreadLocal<>();

    public static void set(LoginUser loginUser) {
        threadLocal.set(loginUser);
    }

    public static LoginUser get() {
        return threadLocal.get(); // 从当前线程获取
    }

    public static void remove() {
        threadLocal.remove();
    }
}
